package ${package_feign};
import com.github.pagehelper.PageInfo;
import ${package_pojo}.${Table};
import com.util.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: ${Table}Feign
 * @description: ${Table}Feign 对外提供的feign接口
 * @author: 李东
 * @Date: 2020-7-20
 */
@FeignClient(name="${serviceName}")
@RequestMapping("/${table}")
public interface ${Table}Feign {

    /***
     * ${Table}分页条件搜索实现
     * @param ${table}
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/search/{page}/{size}" )
    Result<PageInfo> findPage(@RequestBody(required = false) ${Table} ${table}, @PathVariable  int page, @PathVariable  int size);

    /***
     * ${Table}分页搜索实现
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}" )
    Result<PageInfo> findPage(@PathVariable  int page, @PathVariable  int size);

    /***
     * 多条件搜索品牌数据
     * @param ${table}
     * @return
     */
    @PostMapping(value = "/search" )
    Result<List<${Table}>> findList(@RequestBody(required = false) ${Table} ${table});

    /***
     * 根据ID删除品牌数据
     * @param <#list primaryKeys as pr>${pr.name}<#if pr_has_next>,</#if></#list>
     * @return
     */
    @DeleteMapping(value = "<#list primaryKeys as pr>/{${pr.name}}</#list>" )
    Result delete(<#list primaryKeys as pr>@PathVariable("${pr.name}") ${pr.type} ${pr.name}<#if pr_has_next>,</#if></#list>);

    /***
     * 修改${Table}数据
     * @param ${table}
     * @param <#list primaryKeys as pr>${pr.name}<#if pr_has_next>,</#if></#list>
     * @return
     */
    @PutMapping(value="<#list primaryKeys as pr>/{${pr.name}}</#list>")
    Result update(@RequestBody ${Table} ${table},<#list primaryKeys as pr>@PathVariable("${pr.name}") ${pr.type} ${pr.name}<#if pr_has_next>,</#if></#list>);

    /***
     * 新增${Table}数据
     * @param ${table}
     * @return
     */
    @PostMapping
    Result add(@RequestBody ${Table} ${table});

    /***
     * 根据ID查询${Table}数据
     * @param <#list primaryKeys as pr>${pr.name}<#if pr_has_next>,</#if></#list>
     * @return
     */
    @GetMapping("<#list primaryKeys as pr>/{${pr.name}}</#list>")
    Result<${Table}> findById(<#list primaryKeys as pr>@PathVariable("${pr.name}") ${pr.type} ${pr.name}<#if pr_has_next>,</#if></#list>);

    /***
     * 查询${Table}全部数据
     * @return
     */
    @GetMapping
    Result<List<${Table}>> findAll();
}